Repository navigation
Conversation
- IFlowOperator 新增 default getIdentity()/getIdentityAttributes(),下游存量实现零改动即可编译 - 新增 OperatorIdentity:null 与空串统一归一化为默认身份,供全链路比较与存储复用 - FlowRecord 增加发起/提交/当前/转交/干预五组身份字段,FlowTodoRecord 增加三组身份字段 - FlowRecordEntity/FlowTodoRecordEntity 与 Convertor 双向映射,历史数据 identity 为 null 时读取归一化为空串 - GroovyScriptRequest 暴露 getCreatedOperatorIdentity/getCurrentOperatorIdentity/getSubmitOperatorIdentity - FlowOperator 响应体携带身份,保留 (id, name) 双参构造器保证下游源码兼容 - P1 不改变任何判定逻辑与待办合并键格式,identity 为空时行为与历史一致 Closes #288
P2 透传与隔离: - FlowOperatorGateway 新增 default get(id, identity),下游存量实现零改动;IRepositoryHolder 同步新增 getOperatorById(id, identity) - FlowOperatorLocalThreadCache 缓存键由 userId 升级为 (userId, identity),同一人两个身份不再串味 - 请求体统一支持 operatorIdentity:create/action/revoke/delete/urge/detail/processNodes/reissue/forceSync/subProcessReset - REST 层新增 operatorIdentity 参数(与 operatorId 对称),未传时取当前登录操作者身份 - getTodoKey 采用兼容追加策略:默认身份保持历史格式,非空身份追加 #identity,升级中的存量待办合并关系不断裂 - 待办/已办/抄送查询按 (operatorId, identity) 过滤,默认身份用 coalesce(identity,'') 覆盖历史 NULL 行 - FlowRecordContent 列表响应补充发起/提交/当前三组身份,供前端列表展示 P3 判定升级为 (userId, identity): - WorkflowStrategyManager.verifyOperator 增加身份比较(审批参与人校验) - 撤销/删除/催办/子流程重置的记录归属校验加入身份 - OperatorManager(加签/减签/转交/委托)按人员+身份匹配 - 加签待办队列查重、减签目标解析按 (userId, identity) 去重 - 提交人==审批人的自动通过判定、流程干预人识别加入身份 - 详情/流程树/延迟触发/子流程会话/转交/delegate 等按记录身份回查操作者 文档与升级: - 新增 docs/Integration/operator-identity.md(模型、SPI、请求参数、脚本用法、兼容性与限制) - 新增 docs/Integration/sql/0.3.0-operator-identity.sql(加列 + 索引建议 + 达梦说明 + 自检 SQL) - 示例工程 FlowOperatorGatewayImpl/User 提供身份参考实现(返回带身份的副本,避免污染持久化上下文) 验证:./mvnw clean install 全量通过,453 个用例 0 失败(framework 430 / infra 6 / api 2 / starter 8 / example 7)。 新增用例 13 个:待办合并键身份维度 4、缓存身份隔离 4、审批判定身份 3、待办查询身份隔离(含历史 NULL)2。 Closes #288
- IBeanFactory / FlowScriptContext 新增 getOperatorById(userId, identity),default 实现走 GatewayContext - GroovyScriptBind 新增 $bind.getOperatorByIdentity(userId, identity),脚本可让指定人员以指定身份参与, 例如审批人脚本返回 [$bind.getOperatorByIdentity(2, 'department1')] - 文档补充脚本用法示例
基于 PR #289 的评审结论,修复 6 个衍生问题并补齐用例: #290 详情页 currentNodeOperators 改为按 (人员id, 身份) 复合键去重, 排除当前操作人时也同时比较身份,避免同一人的第二个身份被吞掉。 #291 Mock 待办 / 已办 / 抄送查询补齐身份隔离重载,与真实 JPA 口径一致 (历史 NULL 身份按默认身份命中),带 mockKey 的联调不再串味。 #292 人员指定支持 (人员id, 身份) 二元组:新增 OperatorKey 与 operatorSelectOperators,分配表 JSON 兼容 [1,2,3] 与对象数组两种格式, 无需新增列 / DDL;PassAction 与 InitiatorSelectNodeService 统一用 hasAssignment 判定,兼容存量 map、新字段及发起时已落库的分配; 二次发起连同身份一起复制。 #293 网关与仓储持有者补批量取人身份重载,线程缓存按 (id, identity) 隔离; 流程树改为按记录身份分组预加载,消除多身份场景的 N+1 回查。 #294 新增 OperatorIdentity.validate(长度 64 / 禁止 # 与控制字符), 实体列宽与 DDL 对齐;落库前校验、读取仍宽松; 新增 OperatorIdentityGuard 对身份静默降级输出去重 WARN; clearNotify 同步清理 forwardOperatorIdentity。 #295 新增 25 个用例:多身份真实流程、Mock 查询隔离、脚本按身份取人、 批量身份缓存、身份校验与告警、转交身份清理、当前节点待审批人。 全量 478 用例 0 失败(原 453)。 文档:operator-identity.md 补充批量重载、人员指定、Mock 口径与写入约束; 升级 SQL 说明人员分配表无需改表。 Refs #290, #291, #292, #293, #294, #295
- 移除 IFlowOperator#getIdentityAttributes 扩展点及对应测试断言 - 示例用户实体 identity 字段改为持久化,不再标记 @transient - 更新 flow-frontend 子模块指针
- 批量取人:下游未覆盖 findByIds(ids, identity) 时逐条回退到按身份单条取人, 身份不符的结果不再登记线程缓存,避免污染同线程后续按身份的读取 (示例工程只覆盖单条 get 时会静默丢失身份,现已由用例守住) - 发起 / 审批入口补 OperatorIdentityGuard 降级告警 - REST 入口:operatorIdentity 参数在入口校验;覆盖 operatorId 时不再继承登录用户身份, 避免「目标人员 + 登录人身份」错配 - 示例:User.identity 恢复 @transient(运行期身份),网关补 findByIds(ids, identity) 参考实现 - 文档:清理已移除的 getIdentityAttributes,补「启用身份的时机」迁移指引与示例验证步骤
- 新增 IdentityDemoInitializer:首次启动创建演示账号 user1/user2(密码 123456)与 流程 identity-demo,并以三种身份组合各发起一条流程,把待办投给 「张三·默认身份」「张三·department1」「李四·department2」 - 幂等:流程编码已存在时跳过;可通过 flow.example.identity-demo-enabled=false 关闭 - AdminInitializer 显式 @order(10),保证 admin 先于依赖它的初始化器创建 - 文档 5.2 补充演示账号、验证步骤与前端 dev 启动方式
- 新增 5.3:发起人设定审批人只带人员 id(OperatorKey.ofDefault),不继承发起人身份, 导致「审批人是 admin 却看不到待办」;给出排查顺序与 OperatorKey.of 带身份的写法 - 记录前端接入约定:身份参数只注入 /api/ 前缀的引擎接口,避免污染宿主接口的查询参数解析
- 新增 OperatorIdentityMatchMode(STRICT / USER_ONLY)与 OperatorIdentityPolicy,收口审批、撤回、催办、删除、子流程重置、减签、干预留痕、同人自动通过、详情页待审批人匹配等判定 - starter 新增 FlowProperties(codingapi.flow.identity.match-mode,默认 USER_ONLY),启动时由 OperatorIdentityPolicyRegister 写入 framework;framework 默认仍为 STRICT - 查询接口新增 identityScope(ALL / LOCKED,默认 ALL),operatorIdentity 不再隐式过滤,前端携带身份不会导致待办消失 - 文档补充查询范围、判定模式与留痕口径;新增策略与跨身份办理单测
- operator-identity:补查询范围(identityScope)、判定模式(USER_ONLY/STRICT)口径,修正过渡建议与 3.3 请求示例,补充自定义 FlowRecordQueryService 未覆盖身份重载会导致 LOCKED 静默退化 - rest-api:补 operatorIdentity 解析规则、查询身份范围参数表、FlowRecordQueryService 身份重载说明 - auto-configuration:补 OperatorIdentityPolicyRegister 与 SpringFlowEventPublisher、配置项 codingapi.flow.identity.match-mode,修正条件注解描述 - capabilities/gateway-context:补多身份需覆盖的网关 default 重载 - Integration/README:更新文档索引描述与 Bean/Register 数量
…ch-mode Feature/issue 297 identity match mode
- 待办合并键由匹配模式决定:USER_ONLY 按人合并(身份不进键),STRICT 保持 历史兼容追加格式,避免同一人出现两条重复待办 - 加签「是否已在待办队列」改由 OperatorIdentityPolicy 判定:USER_ONLY 下 同人换身份视为同一人,拒绝重复加签;STRICT 下仍按 (人, 身份) 区分 - 新增 OperatorIdentityBoundaryTest(13 例):撤回/催办、加签/减签、 转交与干预留痕、同人自动通过的 USER_ONLY / STRICT 双模式断言 - FlowSubProcessResetServiceTest 补 2 例:子流程重置的身份归属校验 - 同步 operator-identity.md 4.2 / 4.4 / 5.1 口径
test(identity): 补齐身份边界用例并收口合并键/加签查重(#295)
- ErrorThrow 增加 PROMPT 类型与 message 字段,NODE/OPERATORS 语义保持不变 - ErrorTriggerScript 支持 Map 返回值(prompt/node/operators),兼容 String/List/Number 历史写法 - 默认 errorTrigger 由「回退至开始节点」改为「异常提示」,业务方可通过 IScriptRegistry 覆盖文案 - BaseAuditNode 在取人为空且配置为 PROMPT 时阻断操作,抛出 validation.node.operatorEmpty - 新增 FlowPrecheckService 与 POST /api/cmd/record/precheck,只预测直接下一节点,只读不落库 - 补充 ErrorTriggerScriptTest、FlowPrecheckServiceTest - 更新 REST 接口文档 Closes #296
- 新增 capabilities/flow-engine-framework/flow-precheck.md,说明预检语义、返回结构与只读约束 - script.md 补充 errorTrigger 四种返回格式与 prompt 处理方式 - flow-service.md 入口表补 precheck - extension-points.md 补 ErrorThrow 三种类型与 nextNodeOperatorEmpty - 同步 capabilities 索引 Refs #296
预检属于业务侧的交互决策,框架不应内置。框架只需要在异常处理配置为 「异常提示」时返回可展示的错误信息,由业务层决定如何呈现与是否阻断。 - 删除 FlowPrecheckService / FlowPrecheckRequest / PrecheckNode 及其测试 - 移除 FlowService#precheck 与 POST /api/cmd/record/precheck - 回退 REST 文档中的预检章节,保留 errorTrigger 三种语义说明 - 移除 capabilities 中的 flow-precheck 文档,索引回退为 22 篇 - 保留 ErrorThrow.PROMPT、ErrorTriggerScript Map 解析、默认脚本与提交侧阻断 Refs #296
身份原先前端以 query 参数 operatorIdentity 注入所有 /api/ 请求,而引擎的 /api/query/workflow/list 用 SearchRequest 接收请求,会把 query 参数当作实体 过滤字段解析,直接抛 Field operatorIdentity not found in class hierarchy。 - OperatorIdentity 新增 X-Operator-Identity / X-Identity-Scope / X-Lock-Identity 请求头常量与 pick()(请求头优先、区分「未携带」与「显式空串」) - FlowRecordController、FlowRecordQueryController 身份解析改为请求头优先, 保留 query 读取以兼容旧调用方 - 查询身份范围(identityScope / lockIdentity)同步支持请求头 - 更新 operator-identity 文档与 curl 示例 - 新增 OperatorIdentityHeaderResolveTest 覆盖优先级与非法值拒绝 Closes #301
feat(#296): errorTrigger 支持异常提示(prompt)语义
fix(#301): 身份改为请求头传递,修复流程列表 500
脚本返回值不再被强转为 Long,统一由 OperatorScriptResultResolver 解析, 支持 List<Long>(默认身份)、List<OperatorKey>(按身份回查)、 List<IFlowOperator>(直接采用)三种形态,允许同一列表混用。 - 新增 OperatorScriptResultResolver:按身份分组批量回查、按脚本顺序输出, 非正数 id(存量 -1 表示无审批人)跳过,非法元素抛 FlowValidationException - OperatorLoadScript / ErrorTriggerScript 统一走解析器 - OperatorLoadStrategy 的分配回查逻辑下沉到解析器 - 脚本 API:request.getCreatedOperatorKey / getCurrentOperatorKey / getSubmitOperatorKey / findPreviousNodeOperators,$bind.getOperatorKey - FlowSession 新增 loadPreviousNodeOperators(保留记录上的身份) - 脚本工厂的描述同步三种返回形态 Refs #303
- ScriptDefaultConstants 默认取人脚本改为 [request.getCreatedOperatorKey()] - operator-identity.md §3.4 补齐三种返回形态、默认模板、Key 构造 API 与 findPreviousNodeOperators 用法;§5 补默认脚本升级的兼容说明 Closes #303
办结动作此前不写任何身份字段:current_* 是待办归属、submit_* 是创建该记录时的上游提交人, 最后一步办理身份因此没有落点。新增 handle_operator_id/name/identity 三元组,由办结动作显式写入。 - FlowRecord 新增 handleOperator 三元组与 markHandleOperator / clearHandleOperator - Pass / Return / Reject / Transfer / Delegate 办结后写入;SaveAction 暂存与 notifyRecord 抄送不写 - FlowRecordEntity / FlowRecordConvertor / FlowRecordContent 补齐映射(存量数据为空) - DDL 脚本补三列,operator-identity.md 更新留痕口径 Closes #306
查询层通过 FlowRecordContentConvertor.convert(FlowRecordEntity) 组装列表数据, 不走领域对象链路;本次只改了领域对象与实体映射,漏了该转换器, 导致已落库的办理人/办理身份在已办、全部流程列表始终返回 null, 前端只能回退到待办归属人。 - 转换器补 handleOperatorId/Name/Identity 映射(存量数据身份归一化为空串) - 新增 FlowRecordContentConvertorTest 覆盖已办记录与存量记录两种情况
…ipt-resolver feat: 取人脚本支持返回 OperatorKey 与操作者对象,默认模板带创建者身份 (#303)
…tor-identity feat: 记录办理人与办理身份,补齐已办留痕 (#306)
前端 flow-frontend dev 已合入 PR #91(a8f5ff5e): - 待办/已办列表的「审批人」+「身份」两列合并为「办理人」(名字 + 身份标签), 消除同一列在待办与已办下语义漂移的歧义 - 移动端已办改为优先取 handle_operator_name/identity,修复已办显示待办归属人的问题 - PC 补齐列宽并启用横向滚动,避免窄窗口中文列名竖排 子模块指针由 775d07b0 更新到 a8f5ff5e。
P1 相等收敛: - OperatorKey 新增 matches(key, mode) / identityEquals(identity) / of(IFlowOperator) - OperatorIdentityMatchMode 由「被外部 if 判断的枚举」改为策略,自己实现 match 与 identityDistinguishes - OperatorIdentityPolicy#matches/sameOperator 改为委托,删除重复的 id+身份比较逻辑 - OperatorManager 去掉 getOperator(long) / getOperator(long,String) 两个重叠重载,收为一个 match(IFlowOperator) - FlowOperatorLocalThreadCache#isIdentityMatched 改为委托 identityEquals P2 键收敛(参与人键部分): - OperatorKey#key() 成为唯一键生成点,分隔符常量收敛为 1 份(改为 U+0001,身份不可能包含) - OperatorKey#key(mode) 承接「模式是否区分身份」,调用方不再自行判断模式后拼键 - 缓存键、身份告警去重键、当前节点待审批人去重键全部改用 OperatorKey - 删除 4 份重复的分隔符声明(cache/guard/todoKey/FlowContent 各自一份) 行为零变化:现有身份相关测试断言未修改。 Refs #311
- 新增 record/TodoMergeKey:基础段 {人员id}-{workRuntimeId}-{nodeId} 不可变,
严格模式且身份非默认时追加 #identity,仅人员模式不追加
- FlowRecord#getTodoKey() 只保留「谁参与合并」的领域决策,键拼装委托 TodoMergeKey
- 删除 FlowRecord 自declared 的 IDENTITY_KEY_SUFFIX 与手写 String.format 拼装
- OperatorIdentity.KEY_SEPARATOR 更名为 RESERVED_KEY_MARK,语义明确为「身份保留字符」,
TodoMergeKey 引用同一常量
- 新增 TodoMergeKeyTest 锁住三种格式
Refs #311
…,匹配模式策略化 P3 模式策略化: - OperatorIdentityPolicy → OperatorIdentityContext:它只持有当前模式并传递,判定逻辑不再复制一份 - 删除 reset()(测试专用静态清理),改为 use(mode),测试显式设定与还原 - 4 处「请求人 vs 记录当前办理人」的重复校验收敛为 FlowRecord#verifyOperator(OperatorKey) - 新增 FlowRecord#currentOperatorKey(),调用方不再把 (id, identity) 拆开传 - 8 个调用点改为 OperatorKey + Context,方法体里不再有 if (mode == USER_ONLY) - starter: OperatorIdentityPolicyRegister → OperatorIdentityConfigurer 行为零变化:framework 全量 539 个测试通过。 Refs #311
P4 对象化(#308、#311): - OperatorScriptResultResolver:4 个静态 resolve 重载 → 构造注入 (IRepositoryHolder, scriptType) + 单个 resolve(result) - 解析主流程拆为「归一化 → 元素化 → 批量回查 → 按序还原」,五段 instanceof + continue 下沉为元素对象 - 新增 OperatorScriptElement(sealed,Direct/Pending 各自回答「是否有效」「对应谁」) - 新增 PendingOperators:键集合 + 仓储即状态,按身份分组一次查完,替代原 batchResolve 私有函数 - OperatorAssignmentService:静态函数集合 → 构造注入 FlowSession;hasAssignment(nodeId) / assign(processId, selections) - 新增 OperatorSelections:两种表达形式(id / key)归并为一种,携带身份优先的规则只有一个定义点 - FlowActionService / FlowCreateService 的 if-else 二选一消失,改为传 OperatorSelections 行为零变化:framework 全量 550 个测试通过(含新增 20 个)。 Closes #308
P5 类型化(#311): - OperatorIdentity:静态工具类 + 常量集合 → 不可变值对象(of / value / isDefault / validate / equals) - 归一化、判等、校验收为实例语义,全仓调用点迁移为 of(x).value() / .isDefault() / .equals(...) - OperatorIdentity.pick 与三个请求头常量移入接入层 OperatorIdentityHeader(starter-api), 查询侧复用同一份常量(query → api 依赖) - OperatorIdentityGuard → diagnostic.OperatorIdentityWarnLog:可观测性组件移出领域包, 去重状态由静态集合改为实例字段,删除测试专用 resetWarnedCache() - 规范文档同步落地记录与 API 变更清单 行为零变化:全仓 6 个模块测试通过(framework 554)。 Refs #311
refactor(operator): 多身份模型收敛 — 语义契约 + P1~P5 落地
- 删除 docs/conventions/domain/operator-identity.md:内容为改造前现状、 P1~P5 分批计划与落地记录,属过程文档,不满足「可判定规则」的定位 - 新增 docs/capabilities/flow-engine-framework/operator-identity.md: 当前模型构成、两个唯一真源(相等判定 / 键生成)、匹配模式、设计约束 - 新增 docs/conventions/docs/documentation.md:四类文档各有唯一归属、 过程记录不入规范、代码是唯一事实源、计数可复算、代码与文档同批提交 - AGENTS/CLAUDE 基本规范与 OperatorKey javadoc 的引用改到能力文档 - 同步修正 20 份文档中与 dev 代码不一致的事实:身份体系(请求头、 OperatorKey、身份脚本函数)、办理人留痕、事件 12 种、仓储 13 接口、 FlowService 10 入口、配置类改名、版本号 0.3.0-SNAPSHOT - flow-frontend 指针更新(多身份接入与 HttpClient 扩展点文档)
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #313 +/- ##
============================================
+ Coverage 74.30% 76.51% +2.21%
- Complexity 2004 2197 +193
============================================
Files 270 288 +18
Lines 8256 8867 +611
Branches 981 1055 +74
============================================
+ Hits 6135 6785 +650
+ Misses 1630 1557 -73
- Partials 491 525 +34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.